create table if not exists jms_dm.dm_waybill_collect_intime_diagnostic_summary(
        taking_date                          date         NULL COMMENT "揽收日期"
        ,receive_network_code                varchar(255) NULL COMMENT "收件网点code"
        ,customer_code                       varchar(255) NULL COMMENT "客户code"
        ,taking_user_code                    varchar(255) NULL COMMENT "揽收业务员code"
        ,actual_network_shipment_no          varchar(255) NULL COMMENT "网点发件任务单"
        ,receive_network_name                varchar(255) NULL COMMENT "收件网点名称"
        ,taking_user_name                    varchar(255) NULL COMMENT "揽收业务员名称"
        ,customer_name                       varchar(255) NULL COMMENT "客户名称"
        ,receive_proxy_code                  varchar(255) NULL COMMENT "收件代理区code"
        ,receive_proxy                       varchar(255) NULL COMMENT "收件代理区名称"
        ,receive_franchisee_code             varchar(255) NULL COMMENT "收件加盟商code"
        ,receive_franchisee                  varchar(255) NULL COMMENT "收件加盟商名称"
        ,collect_code                        varchar(255) NULL COMMENT "交件集散code"
        ,collect_name                        varchar(255) NULL COMMENT "交件集散名称"
        ,center_code                         varchar(255) NULL COMMENT "交件中心code"
        ,center_name                         varchar(255) NULL COMMENT "交件中心名称"
        ,type                                varchar(255) comment '类型,0:应交件1:无三段码2:无路由3:错发4规划问题5正常6其他'
        ,is_over                             varchar(255) comment '应交件责任标识 1准点 2集散责任 0网点责任'
        ,should_hand_over_num                bigint   COMMENT '应交件票数'
        ,hand_over_in_time_num               bigint   COMMENT '准点交件票数'
        ,hand_over_not_in_time_num           bigint   COMMENT '不准点交件票数'
        ,hand_over_network_resp_num          bigint   COMMENT '交接网点责任票数'
        ,hand_over_collect_resp_num          bigint   COMMENT '交接集散责任票数'
        ,collect_arr_late_cnt                bigint   COMMENT '到集散不准点票数'
        ,center_arr_late_cnt                 bigint   COMMENT '到中心不准点票数'
        ,interrupted_taking_cnt              bigint   COMMENT '截单后揽收量'
        ,taking_no_send_cnt                  bigint   COMMENT '有揽未发量'
        ,network_send_late_cnt               bigint   COMMENT '网点发车晚量'
        ,network_collect_transport_late_cnt  bigint   COMMENT '网点集散运输晚数量'
        ,network_center_transport_late_cnt   bigint   COMMENT '网点中心运输晚数量'
        ,collect_send_late_cnt               bigint   COMMENT '集散发车晚数量'
        ,collect_center_transport_late_cnt   bigint   COMMENT '集散中心运输晚数量'
        ,center_send_timely_cnt              bigint   COMMENT '交件晚点及时发出量'
        ,center_send_late_cnt                bigint   COMMENT '交件晚点未及时发出量'
        ,false_taking_cnt                    bigint   COMMENT '虚假揽收数量'
        ,area_code                           varchar(255)   COMMENT '收件底层片区CODE'
        ,area_name                           varchar(255)   COMMENT '收件底层片区名称'
        ,zone_code                           varchar(255)   COMMENT '市场片区CODE'
        ,zone_name                           varchar(255)   COMMENT '市场片区名称'
        ,network_taking_cnt                  bigint   comment '网点揽收数量'
        ,network_send_cnt                    bigint   comment '网点发件数量'
        ,collect_arr_cnt                     bigint   comment '集散到件数量'
        ,collect_send_cnt                    bigint   comment '集散到件数量'
        ,center_arr_cnt                      bigint   comment '中心到件数量'
        ,center_send_cnt                     bigint   comment '中心发件数量'
)
ENGINE=OLAP
DUPLICATE KEY(`taking_date`, `receive_network_code`, `customer_code`, `taking_user_code`)
COMMENT "交件准点率-诊断预警"
PARTITION BY RANGE(`taking_date`)
(
    START ("2022-09-01") END ("2022-09-30") EVERY (INTERVAL 1 day)
)
DISTRIBUTED BY HASH(`receive_network_code`) BUCKETS 3
PROPERTIES (
  "replication_num" = "3",
  "dynamic_partition.enable" = "true",
  "dynamic_partition.time_unit" = "DAY",
  "dynamic_partition.time_zone" = "Asia/Shanghai",
  "dynamic_partition.start" = "-185",
  "dynamic_partition.end" = "3",
  "dynamic_partition.prefix" = "p",
  "dynamic_partition.buckets" = "4",
  "in_memory" = "false",
  "storage_format" = "V2",
  "enable_persistent_index" = "false"
);
